package amartin47;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.*;
import java.net.*;
import java.util.*;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;

import no.geosoft.cc.graphics.GObject;
import no.geosoft.cc.graphics.GPosition;
import no.geosoft.cc.graphics.GScene;
import no.geosoft.cc.graphics.GText;
import no.geosoft.cc.graphics.GWindow;

public class LyricsSwingWindow extends JFrame implements LyricsWindow {
	
	JLabel lyricsLabel;
	LyricsClient client;
	
	public LyricsSwingWindow() {
	    super ("Lyrics Display");    
	    setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);		
		
		this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 		this.setMinimumSize(new Dimension(900,900));
 		this.setResizable(false);
 		this.getContentPane().setBackground(Color.BLACK);
 		
 		lyricsLabel = new JLabel("", SwingConstants.CENTER);
 		lyricsLabel.setFont(new Font(lyricsLabel.getFont().getName(), Font.BOLD, 32));
 		lyricsLabel.setForeground(Color.WHITE);
 		this.add(lyricsLabel, BorderLayout.CENTER);
 		
		this.addWindowListener(new WindowAdapter() {
		      public void windowClosing(WindowEvent e) {
		    	  if(client != null)
		    	  {
		    		  client.stopClient = true;
		    	  }
		      }
		});
		
		client = new LyricsClient(this);
	}
	
	public void updateSlide(String lyrics)
	{
		this.lyricsLabel.setText(lyrics);
	}
	
	public static final void main(final String[] args) throws Exception {
		
 		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 
 		final JFrame fullscreenFrame = new LyricsSwingWindow();
 		//fullscreenFrame.setUndecorated(true);
 		fullscreenFrame.setVisible(true);
 		//GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(fullscreenFrame);
 	}
 
}